/**
 * \file vmsegment.h
 * \brief A segment is a collection of: the binary code (RUnits), associated
 * symbol and direct value tables.
 **/

#ifndef R_VMSEGMENT_H
#define R_VMSEGMENT_H

/* An element of a direct value table. */
struct RDirectValueT {
  uint32_t type;
  union {
    int32_t val_int; /* If type == R_VALUE_INT. */
    char* val_str;   /* if type == R_VALUE_STRING. */
  };
};
typedef struct RDirectValueT RDirectValue;

struct RSegmentT {
  /* The binary data. */
  uint32_t size_code;
  RUnit* code;

  /* The symbol table. */
  uint32_t size_symbols;
  void** symbols;

  /* The direct-value table. */
  uint32_t size_directs;
  RDirectValue* directs;
};
typedef struct RSegmentT RSegment;

#endif /* R_VMSEGMENT_H */
